<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="s"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<%-- Delete url --%>
<s:url value="/school/deleteTeacher" var="deleteUrl11" />


<SCRIPT type="text/javascript">
$(document).ready(function(){

	$(function(){
		$('#dateOfJoining').datepicker({
		dateFormat: 'dd/mm/yy',
		changeYear: true
		});
	});

});

function deleteTeacher(id, tname){
	var status = confirm("Do you want to delete "+ tname +"'s record?");
	if(status){
		var delUrl = '${deleteUrl}?t='+id;
		// alert("delUrl" + delUrl);
		var frm = document.createElement("form");
		frm.setAttribute("method", 'get');
		frm.setAttribute("action", delUrl);
		alert("frm : " + frm.action);
		document.forms["frm"].submit();
		alert("done");
		}else{
		alert('ok');
	}
}

</SCRIPT>

</head>
<body>

<table width="100%">
	<tr>
		<td colspan="3">
		<h4>New Teacher Entry Form</h4>
		</td>
	</tr>
</table>
<p>Fill this form to add a new Teacher to your School.</p>
<form:form action="newTeacherForm" commandName="newTeacherForm"
	method="POST">

	<s:bind path="*">
		<c:if test="${status.error}">
			<div id="message" class="error">Form has errors</div>
		</c:if>
	</s:bind>
	<fieldset><legend>New Teacher Form</legend>
	<table class="form-table" border="0">
		<tr>
			<td colspan="3">
			<h3><u></u></h3>
			</td>
		</tr>
		<tr>
			<td width="100"><form:label path="firstName">First Name</form:label></td>
			<td><form:input path="firstName" id="firstName" /></td>
			<td colspan="2" class="error" width="250">&nbsp;<form:errors
				path="firstName" cssStyle="color:red;" /></td>
		</tr>
		<tr>
			<td width="100"><form:label path="middleName">Middle Name</form:label></td>
			<td><form:input path="middleName" id="middleName" /></td>
			<td colspan="2" class="error" width="250">&nbsp;<form:errors
				path="middleName" cssStyle="color:red;" /></td>
		</tr>
		<tr>
			<td width="100"><form:label path="lastName">Last Name</form:label></td>
			<td><form:input path="lastName" id="lastName" /></td>
			<td colspan="2" class="error" width="250">&nbsp;<form:errors
				path="lastName" cssStyle="color:red;" /></td>
		</tr>
		<tr>
			<td width="100"><form:label path="lastName">Qualifications</form:label></td>
			<td><form:textarea path="qualifications" id="qualifications"
				cols="40" rows="5" /></td>
			<td colspan="2" class="error" width="250">&nbsp;<form:errors
				path="qualifications" cssStyle="color:red;" /></td>
		</tr>
		<tr>
			<td width="100"><form:label path="specialCourses">Special Courses</form:label></td>
			<td><form:textarea path="specialCourses" id="specialCourses"
				cols="40" rows="5" /></td>
			<td colspan="2" class="error" width="250">&nbsp;<form:errors
				path="specialCourses" cssStyle="color:red;" /></td>
		</tr>
		<tr>
			<td width="100"><form:label path="designation">Designation</form:label></td>
			<td><form:select path="designation" id="designation">
				<form:option value="0" label="-- Select --" />
				<form:options items="${designationList}" itemLabel="designation"
					itemValue="designationCode" />
			</form:select></td>
			<td class="error" width="250"><form:errors path="designation"
				cssStyle="color:red;" /></td>
		</tr>
		<tr>
			<td width="100"><form:label path="dateOfJoining">Date Of Joining<br />
			(DD/MM/YYYY)</form:label></td>
			<td><form:input path="dateOfJoining" id="dateOfJoining" /></td>
			<td class="error" width="250"><form:errors path="dateOfJoining"
				cssStyle="color:red;" /></td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td><input type="submit" value="save" class="button" /></td>
			<td>&nbsp;</td>
		</tr>
	</table>
	</fieldset>
</form:form>

</body>
</html>